<?php
$smarty->configLoad($lang . '/events.module.php');
$language = parse_ini_file($lang . '/breadcrumb.module.php', true);
$breadcrumb = $language['add_events'];

if(isset($_POST['submit'])) {
    $main->logAction($_SESSION['id'], 'event_add_log');
    $sql = 'INSERT INTO '.DB_CMS.'.module_events (title, beginn, end, story) VALUES (:title, :beginn, :end, :story)';
    $dbh = $connection->prepare($sql);
    $dbh->bindValue(':title', $_POST['title']);
    $dbh->bindValue(':beginn', $_POST['beginn']);
    $dbh->bindValue(':end', $_POST['end']);
    $dbh->bindValue(':story', $_POST['story']);
    $dbh->execute();
    $main->jqmodal('events');
    echo '<meta http-equiv="refresh" content="5; URL=index.php?mod=events">';
}
$template = 'events/add.tpl';
?>